The present invention relates in general to computer processing and more particularly to a method and device for controlling access to memory.
In a computing environment where a database is shared among various programs, it is difficult to ensure that each program is working with valid data from the database. One program may have changed the contents of the data while another program is using the old contents of the data. As a result, programs may unknowingly be working with corrupted data.
One technique to avoid using corrupted data is providing a copy of the database to all programs executing in the computing environment. However, this technique does not allow for simultaneous reading and writing by more than one program. Another technique to guaranteeing uncorrupted data is through a separate locking program that supervises all access to the database. This technique ensures that the database has valid data at all times for use by the programs in the computing environment. The drawbacks of this technique include the delays involved in constantly accessing the database and the additional overhead processing required for the separate locking program.
Therefore, it is desirable to provide a controlled access to a database where each program operating in the computer environment can be provided valid data from the database.
From the foregoing, it may be appreciated that a need has arisen for a database access technique that allows multiple programs to perform read and write access to valid data in the database. In accordance with the present invention, a method and device for controlling access to memory are provided that substantially eliminate or reduce disadvantages and problems associated with conventional database management operations.
According to an embodiment of the present invention, there is provided a computing device for controlling access to memory that includes a first process and a second process each operable to execute on the computing device. The computing device also includes a database memory for storing data files in page formats. A local memory receives a page from the database memory in response to an access request from the first process. The page includes a counter location that is incremented upon being write accessed by the first process. Upon incrementing, the counter location provides an indication to the second process that the contents of the page are not currently valid. The present invention may also be extended into a network environment with multiple computing devices each having multiple processes sharing data from a common database.
The present invention provides various technical advantages over conventional database management operations. For example, one technical advantage is to eliminate the use of a database manager program. Another technical advantage is in providing a locking protocol within the data stored in a database. Yet another technical advantage is ensure that processes operating in a computing environment do not use corrupted data. Still another technical advantage is to provide an indication to a process desiring access to data as to whether the data is in a valid state. Other technical advantages may be readily apparent to those skilled in the art from the following figures, description, and claims.